package cn.iocoder.yudao.module.iot.dal.mysql.device;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.*;

/**
 * 设备信息 Mapper
 *
 * @author zhagener
 */
@Mapper
public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {

    default PageResult<IotDeviceDO> selectPage(IotDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceDO>()
                .likeIfPresent(IotDeviceDO::getName, reqVO.getName())
                .eqIfPresent(IotDeviceDO::getType, reqVO.getType())
                .eqIfPresent(IotDeviceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(IotDeviceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotDeviceDO::getId));
    }

}